#pragma once
#include "bondlib.h"
#include <mutex>
#include <map>
#include <string>

typedef struct _tag_QBUNDERWRITERINFO{
	char m_UnderwriterUUID[32+1];	//承销商ID
	char m_UnderwriterCode[10+1];	//承销商Code
	char m_Short_Name_C[64+1];		//中文简称
	int	 m_Order;					//排序字段
}QBUNDERWRITERINFO;

class S_BONDLIB_EXPORT CUnderwriterInfo
{
	typedef std::map<std::string, QBUNDERWRITERINFO> QBUNDERWRITERINFOMap;
private:
	QBUNDERWRITERINFOMap m_map; // key = m_UnderwriterUUID, value = m_UnderwriterCode
	std::mutex m_mutex;
public:
	void Clear();
	bool Add(QBUNDERWRITERINFO &info);
	const char* GetUnderwriterCode(const char* sUUID);
	const char* GetUnderwriterUUID(const char* sCode);
	const QBUNDERWRITERINFO * GetUnderwriterByUUID(const char* sUUID);
public://调试用
	void DumpStatus(int mode=0)const;
	static CUnderwriterInfo& instance();
private:
	CUnderwriterInfo(void);
	~CUnderwriterInfo(void);
};
